package com.lzx.dormsys.config;

import com.lzx.dormsys.interceptor.AjaxIntercepter;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class LoginConfig implements WebMvcConfigurer {
    // 注册拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        InterceptorRegistration registration = registry.addInterceptor(new AjaxIntercepter());
        // 设置拦截路径
        registration.addPathPatterns("/**");
        // 排除某些不需要拦截的URL
        registration.excludePathPatterns("/captchaImage");
        registration.excludePathPatterns("/userAction/loginVerify","/error","/favicon.ico");
        registration.excludePathPatterns("/profile/upload/**");
    }
}
